package com.hyacinth.dubbo.io.netty.client.handler;

import com.hyacinth.dubbo.io.netty.protocol.response.GroupMessageResponsePacket;
import com.hyacinth.dubbo.io.netty.session.Session;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author zhangfb
 * @version 1.0.0.1
 * @since JDK 1.8
 */
public class GroupMessageResponseHandler extends SimpleChannelInboundHandler<GroupMessageResponsePacket> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, GroupMessageResponsePacket responsePacket) throws Exception {
        String groupId = responsePacket.getFromGroupId();
        Session fromUser = responsePacket.getFromUser();
        String message = responsePacket.getMessage();

        System.out.println("收到群["+groupId+"]中["+fromUser+"]发来的消息："+message);
    }
}
